#pragma once

#include <boostext/smart_ptr.hpp>
#include <math/vector2.hpp>

#include "exports.hpp"
#include "Cursor.hpp"
#include "Placement.hpp"




namespace Engine
{
	namespace Ui
	{
		class ENGINE_UI_API Widget;
		class ENGINE_UI_API Window;

		class ENGINE_UI_API State
		{
		public:

			/**
			* Get the mouse cursor.
			*/
			virtual const Cursor& cursor() const = 0;

			/**
			* Get the parent position for this widget.
			* Usually a widget modifies this position, to include
			* it's own parent position, when handing a NestedState to a child.
			*/
			virtual int2 parentPos() const = 0;

			/**
			* Get the currently active modal widget.
			*/
			virtual boost::shared_ptr<Widget> modalWidget() const = 0;

			/**
			 * Set the currently active modal widget.
			 */
			virtual void setModalWidget(boost::weak_ptr<Widget> widget) = 0;




			/**
			 * Get the current widget with focus.
			 */
			virtual boost::shared_ptr<Widget> focusWidget() const = 0;

			/**
			 * Set the currently active focus widget.
			 */
			virtual void setFocusWidget(boost::weak_ptr<Widget> widget) = 0;

			/**
			 * Unset the currently active focus widget.
			 */
			virtual void unsetFocusWidget(boost::weak_ptr<Widget> widget) = 0;




			/**
			* Attach a widgets position to the mouse ones.
			* As long as the widget is attached to the cursor,
			* it will move with it.
			*/
			virtual void attach(boost::weak_ptr<Widget> widget) = 0;
			virtual void detach(boost::weak_ptr<Widget> widget) = 0;
			virtual bool isAttached(boost::weak_ptr<Widget> widget) const = 0;

			/**
			* Attach a widgets border to the mouse.
			* This will cause the widget to resize when 
			* the mouse moves.
			*/
			virtual void attachBorder(boost::weak_ptr<Widget> widget, Border::Type border) = 0;
			virtual void detachBorder(boost::weak_ptr<Widget> widget) = 0;
			virtual bool isAttachedBorder(boost::weak_ptr<Widget> widget) const = 0;

			/**
			 * Test if anything is attached to the mouse.
			 */
			virtual bool hasAttached() const = 0;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
